﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using compusUpdates.Properties;

namespace compusUpdates {
    public partial class settingsForm : Form {
        public settingsForm() {
            InitializeComponent();
            this.startupBox.Checked = Settings.Default.startup;
            this.refreshBox.Text = Settings.Default.refresh.ToString();
        }

        private void okBtn_Click(object sender, EventArgs e) {
            bool result = true;
            int refresh = 0;
            try {
                refresh = int.Parse(refreshBox.Text);
            } catch (FormatException) {
                result = false;
            }

            if (result == true && refresh >= 10) {
                Settings.Default.refresh = refresh;
                Settings.Default.startup = this.startupBox.Checked;
                this.Hide();

            } else {
                MessageBox.Show("Wrong Value!");
            }
        }


    }
}
